package com.atguigu.cloud.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * 客户端互相调用工具配置类
 * @author: daiziru
 * @createDate: 2024/3/5 14:24
 */
@Configuration
public class RestTemplateConfig {

    /**
     * 使用bean注入，之后各个类获取到的都是同一个
     * @return RestTemplate
     */
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
